package com.candykingdom.pages
{
	import com.app.components.Button;
	import com.app.events.ControlEvent;
	import com.candykingdom.manage.Manage;
	import com.candykingdom.manage.PageNames;
	
	public class PageIndex extends PageBase
	{
		public function PageIndex()
		{
			super();
			for (var i:int=0;i<5;i++)
			{
				var button:Button = this.getChildByName("b"+(i+1)) as Button;
				button.addEventListener(ControlEvent.CLICK ,buttonClickHandler);
			}
		}
		
		private function buttonClickHandler(event:ControlEvent):void
		{
			switch(event.currentTarget.name)
			{
				case "b2":case "b5":
					Manage.pageModel.pageName = PageNames.KINGDOM;
					break;
				
				case "b1":
					break;
				
				case "b3":
					Manage.pageModel.pageName = PageNames.ACTIVITY;
					break;
				
				case "b4":
					Manage.pageModel.pageName = PageNames.MALL;
					break;
			}
		}
	}
}